Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache genesis block hash in ledger constants #2512

Merged
merged 5 commits into from
Feb 4, 2020

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Jan 24, 2020

Introduced a new member in ledger_constants called genesis_hash. The only way to access it currently is through creating a new class genesis object and then calling a method which parses all of the genesis_account string each time, generates a block then gets the hash from that. This is what the node telemetry currently does, which can be a relatively expensive operation. Also tests use the genesis hash quite frequently so a helper has been added for them too.

I replaced all occurrences of nano::genesis ().hash () with nano::genesis_hash in tests, and also started replacing any nano::genesis genesis; declarations which were only used with genesis.hash and genesis.open->hash () but there was quite a few so haven't done all.

Unrelated - there was an [[no_discard]] warning in memory_pool.cpp on Windows which I have fixed with (void) cast.

@wezrule wezrule added the performance Performance/resource utilization improvement label Jan 24, 2020
@wezrule wezrule added this to the V21.0 milestone Jan 24, 2020
@wezrule wezrule self-assigned this Jan 24, 2020
clemahieu
clemahieu previously approved these changes Jan 28, 2020
@SergiySW
Copy link
Contributor

Also there is reference in json_handler.cpp nano::json_handler::version ()

@wezrule wezrule merged commit 45722d8 into nanocurrency:develop Feb 4, 2020
@wezrule wezrule deleted the cache_genesis_hash branch February 4, 2020 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance/resource utilization improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants